package com.information.manage.basic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.information.manage.basic.model.dto.UserMenuListDTO;
import com.information.manage.basic.model.entity.SysUserDO;
import com.information.manage.basic.model.vo.SysUserPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: initialmind
 * Date: 2022-03-06.
 * Description:
 * Version: V1.0
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUserDO> {

    /**
     * 查询满足条件的用户数量
     * @param userName
     * @param staffIds
     * @param roleId
     * @return
     */
    Integer queryUserCount(@Param("userName") String userName, @Param("staffIds") List<Integer> staffIds, @Param("roleId") Integer roleId);

    /**
     * 用户查询分页
     * @param page
     * @param userName
     * @param description
     * @param roleId
     * @param staffName
     * @param startTime
     * @param endTime
     * @return
     */
    Page<SysUserPageVO> queryUserPage(Page page, @Param("userName") String userName, @Param("description") String description
            , @Param("roleId") Integer roleId, @Param("staffName") String staffName, @Param("startTime") LocalDateTime startTime
            , @Param("endTime") LocalDateTime endTime);

    /**
     * 查询用户菜单
     * @param userId
     * @param description
     * @param menuName
     * @return
     */
    List<UserMenuListDTO> findUserMenuList(@Param("userId") Integer userId, @Param("description") String description, @Param("menuName") String menuName);

    Integer userPageCount(@Param("userName") String userName);
}
